﻿namespace Blaze.Framework.MonoEventListeners
{
    using UnityEngine;

    public class Transform : MonoBehaviour
    {
        public event EventHandler OnTransformChildrenChangedEvent;

        public event EventHandler OnTransformParentChangedEvent;

        public static Transform Get(GameObject obj)
        {
            return obj.GetOrAddComponent<Transform>();
        }

        private void OnTransformChildrenChanged()
        {
            if (OnTransformChildrenChangedEvent != null)
                OnTransformChildrenChangedEvent(gameObject);
        }

        private void OnTransformParentChanged()
        {
            if (OnTransformParentChangedEvent != null)
                OnTransformParentChangedEvent(gameObject);
        }
    }
}